﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BDS3M.Admin.Controls
{
    public partial class ViewPhapLuat : System.Web.UI.UserControl
    {
        public string tieude;
        public string title;
        public string image;
        public string summary;
        public string description;
        public string download;
        public string date;
        public int id;
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Request.QueryString["id"] != null)
            {
                id = Convert.ToInt32(Request.QueryString["id"]);
                DataTable dt = DAL.DCollector.DBCollector.Instance.StoredSelectAllTableWhereID("tbl_PhapLuat", "PhapLuat_ID", id.ToString());
                tieude = dt.Rows[0]["PhapLuat_TieuDe"].ToString();
                title = dt.Rows[0]["PhapLuat_Title"].ToString();
                image = dt.Rows[0]["PhapLuat_Image"].ToString();
                summary = dt.Rows[0]["PhapLuat_Summary"].ToString();
                description = dt.Rows[0]["PhapLuat_Description"].ToString();
                download = dt.Rows[0]["PhapLuat_DownLoad"].ToString();
                date = dt.Rows[0]["PhapLuat_Date"].ToString();
                
                txtTieuDe.Text = tieude;
                txtTitle.Text = title;
                txtSummary.Text = summary;
                txtDescription.Text = description;
                txtDownload.Text = download;
                txtDate.Text = date;
            }

        }

        protected void lbtDelete_Click(object sender, EventArgs e)
        {
            id = Convert.ToInt32(Request.QueryString["id"]);
            DAL.DCollector.DBCollector.Instance.StoredProcedureDeleteByRows("tbl_PhapLuat", "PhapLuat_ID", id.ToString());
            Response.Redirect("/Admin/Index.aspx?panel=3&sub=26");
        }
    }
}